<?php
$times = 10000;$i = 0;
$datas = array();
while($i <= $times) {
    $datas[$i]=array('9');
    $is=$i++;
};

$start = microtime(true);
foreach($datas as $index =>$data)$data[0]+ 1;
echo '1.-单条语句耗时foreach=>)'.(microtime(true) -$start).'秒/'.$times.'次.'."\n";
$start = microtime(true);
for($i = 0; $i < $times; $i ++) $datas[$i][0] + 1;
echo "2--单条语句耗时for =>".(microtime(true) - $start).'秒/'.$times.'次'."\n";
    
$start = microtime(true);
foreach($datas as $index => $data){
    $data[0] + 1;
}
echo'<br/>3.带花括号语句块耗时 foreach=>'.(microtime(true)-$start).'秒/'.$times.'次'."\n";

$start =microtime(true);
for($i =0; $i <$times; $i ++) {
    $datas[$i][0] +1;
}
echo'<br/>4.--.-带花括号语句块耗时for=>'.(microtime(true) - $start).'秒/'.$times.'次'."\n";
